using System;
using System.Collections.Generic;
using System.Text;

namespace WeatherRouter.Services
{
    public abstract class ServiceResponse
    {
        public enum ResponseCodeType: int {Success = 0, ValidationFailed = 100, Failure = 200}
    
        private ResponseCodeType _responseCode;
        private string _shortMessage;
        private string _longMessage;
        private string _responseMachine;
        private string _responseIpAddress;

        /// <summary>
        /// Default constructor.
        /// </summary>
        public ServiceResponse()
        {
            _responseMachine = Environment.MachineName;
            _responseIpAddress = System.Net.Dns.GetHostAddresses("localhost")[0].ToString(); 
        }

        /// <summary>
        /// Constructor with response code.
        /// </summary>
        /// <param name="responseCode">Response code.</param>
        public ServiceResponse(int responseCode)
            : this()
        {
            _responseCode = (ResponseCodeType) Enum.Parse(typeof(ResponseCodeType), responseCode.ToString());
        }

        /// <summary>
        /// Constructor with response code.
        /// </summary>
        /// <param name="responseCode"></param>
        public ServiceResponse(ResponseCodeType responseCode)
            : this ()
        {
            _responseCode = responseCode;                
        }

        public ServiceResponse(ResponseCodeType responseCode, string shortMessage, string longMessage)
            : this()
        {
            _responseCode = responseCode;
            _shortMessage = shortMessage;
            _longMessage = longMessage;
        }

        /// <summary>
        /// Short message.
        /// </summary>
        public string ShortMessage
        {
            get { return _shortMessage; }
            set { _shortMessage = value; }
        }

        /// <summary>
        /// Long message.
        /// </summary>
        public string LongMessage
        {
            get { return _longMessage; }
            set { _longMessage = value; }
        }
    }
}
